using System.ComponentModel.DataAnnotations;
using System.ComponentModel.DataAnnotations.Schema;
using Microsoft.EntityFrameworkCore;

namespace Terra.Data.Entities.Logging;

/// <summary>
/// 操作日志实体
/// </summary>
[Table("OperationLogs")]
[Comment("操作日志表")]
[Index(nameof(Module))]
[Index(nameof(OperationTime))]
public class OperationLog : LogEntityBase
{
    /// <summary>
    /// 模块名称
    /// </summary>
    [Required]
    [MaxLength(128)]
    [Comment("操作模块名称")]
    public string Module { get; set; }

    /// <summary>
    /// 操作类型
    /// </summary>
    [Required]
    [MaxLength(32)]
    [Comment("操作类型：如 Create、Update、Delete 等")]
    public string OperationType { get; set; }

    /// <summary>
    /// 操作说明
    /// </summary>
    [Required]
    [MaxLength(512)]
    [Comment("操作说明")]
    public string Description { get; set; }

    /// <summary>
    /// 操作时间
    /// </summary>
    [Required]
    [Comment("操作执行时间")]
    public DateTime OperationTime { get; set; }

    /// <summary>
    /// 请求参数
    /// </summary>
    [Comment("请求参数JSON")]
    public string RequestData { get; set; }
}